﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Vit.Web.DataAnnotations
{
    public class StringLengthModelValidator : DataAnnotationsModelValidator<StringLengthAttribute>
    {
        public StringLengthModelValidator(ModelMetadata metadata, ControllerContext context, StringLengthAttribute attribute)
            : base(metadata, context, attribute)
        {
        }


        public override IEnumerable<ModelClientValidationRule> GetClientValidationRules()
        {
            return new ModelClientValidationRule[] 
            { 
                new ModelClientValidationStringLengthRule(base.ErrorMessage, 0, base.Attribute.MaximumLength) 
            };
        }   
    }
}
